﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MSScriptControl;
using ICSharpCode.SharpZipLib.Zip;
using System.Reflection;
namespace TestForCom
{
    public partial class Form1 : Form
    {
        private IScriptControl msc = new ScriptControlClass();
        public class Person
        {
            public void p(string  str)
            {
               
            }
            public bool getTrue()
            {
                return false;
            }
        }
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            msc.Language = "JScript";
            msc.Reset();

            try
            {
               
                object[] param = new object[1] {1};
                Person s = new Person();
                msc.AllowUI = true;
                msc.AddObject("ps", s, true);
                msc.AddCode(textBox2.Text);
                msc.Run("main", ref  param);
            }
            catch (Exception ex)
            {
                Console.WriteLine(msc.Error.HelpFile);
            }

        }
    }
}
